package com.lyu.xiaolvshu.user.api;

import com.lyu.framework.common.response.Response;
import com.lyu.xiaolvshu.user.constant.ApiConstants;
import com.lyu.xiaolvshu.user.dto.req.FindUserByIdReqDTO;
import com.lyu.xiaolvshu.user.dto.req.FindUserByPhoneReqDTO;
import com.lyu.xiaolvshu.user.dto.req.RegisterUserReqDTO;
import com.lyu.xiaolvshu.user.dto.req.UpdateUserPasswordReqDTO;
import com.lyu.xiaolvshu.user.dto.resp.FindUserByIdRespDTO;
import com.lyu.xiaolvshu.user.dto.resp.FindUserByPhoneRespDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = ApiConstants.SERVICE_NAME)
public interface UserFeignApi {

    String PREFIX = "/user";

    @PostMapping(value = PREFIX + "/register")
    Response<Long> register(@Validated @RequestBody RegisterUserReqDTO registerUserReqDTO);

    @PostMapping(value = PREFIX + "/findByPhone")
    Response<FindUserByPhoneRespDTO> findUserByPhone(@Validated @RequestBody FindUserByPhoneReqDTO findUserByPhoneReqDTO);

    @PostMapping(value = PREFIX + "/password/update")
    Response<?> updatePassword(@Validated @RequestBody UpdateUserPasswordReqDTO updateUserPasswordReqDTO);

    @PostMapping(value = PREFIX + "/findById")
    Response<FindUserByIdRespDTO> findById(@Validated @RequestBody FindUserByIdReqDTO findUserByIdReqDTO);
}
